<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Manazra.Controllers.BlogViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Edit Blog: <%= Html.Encode(Model.Blog.Title) %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Edit Blog: <%= Html.Encode(Model.Blog.Title) %></h2>

    <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>

    <% using (Html.BeginForm()) {%>
        <p>
            <label for="Title">Title:</label>
            <%= Html.TextBox("Title", Model.Blog.Title, new { size = 80 })%>
            <%= Html.ValidationMessage("Title", "*") %>
        </p>
        
        <% if (Model.Blog.BlogEntries.Count() > 0) { %>
          <table width="80%">
            <tr>
                <th colspan="3">Articles Linked to this Blog</th>
            </tr>
            
            <% foreach (var item in Model.Entries) { %>
                <tr>
                    <td><%= Html.Encode(item.Title)%></td>
                    <td><%= String.Format("<a href='/Articles/Edit/{0}'>Edit</a>", item.RecId) %></td>
                    <td><%= String.Format("<a href='/Articles/Delete/{0}'>Delete</a>", item.RecId) %></td>
                </tr>
            <% } %>
          </table>  
        <% } %>
        
        <p>
            <input type="submit" value="Save" />
        </p>    
    <% } %>

    <div>
        <a href="/Blogs">Cancel and Go Back to Blogs</a>
    </div>

</asp:Content>

